package org.KeyCrafter.obj;

import org.KeyCrafter.ds.dict.DictType;
import org.KeyCrafter.ds.dict.HashDict;
import org.KeyCrafter.ds.dict.MurmurHash2;
import org.KeyCrafter.ds.list.LinkedList;
import org.KeyCrafter.ds.list.List;
import org.KeyCrafter.obj.type.*;
import org.KeyCrafter.server.ServerContext;

public class KeyCrafterObjFactory {
    private static  ServerContext sc = ServerContext.DEFAULT;
    private static final DictType DEFAULT_DICT_TYPE = new MurmurHash2();

    public static StringObj newStringObj(String data) {
        StringType type = new DefaultStringType(data);
        StringObj obj = new StringObj(type);
        obj.setLRU(sc.LRU_CLOCK());
        return obj;
    }

    public static HashObj newHashObj() {
        HashType type = new DefaultHashType();
        HashObj obj = new HashObj(type);
        obj.setLRU(sc.LRU_CLOCK());
        return obj;
    }

    public static ListObj newListObj() {
        ListType type = new DefaultListType();
        ListObj obj = new ListObj(type);
        obj.setLRU(sc.LRU_CLOCK());
        return obj;
    }

    public static SetObj newSetObj() {
        SetType setType = new DefaultSetType();
        SetObj obj = new SetObj(setType);
        obj.setLRU(sc.LRU_CLOCK());
        return obj;
    }

    public static KeyCrafterObject newZSetObj() {
        ZSetType zSetType = new DefaultZSetType();
        ZSetObj obj = new ZSetObj(zSetType);
        obj.setLRU(sc.LRU_CLOCK());
        return obj;
    }
}
